#include "qfish.h"

Qfish::Qfish(const QString & fileName,QGraphicsScene *scence):QpimapItem(fileName,scence)
{

}

void Qfish::advance(int phase)
{

    if(mapToScene(0,0).y()<=0||mapToScene(0,0).x()>=1269)
    {
        setPos(qrand()%1000,qrand()%500);
    }
    bool flag=1;
    int n,m;
    int speed1=qrand()%10;
    int speed2=(qrand()%100-qrand()%10)/10-4;
    n=speed1,m=speed2;
    //倍速
    int b=1;
    this->setPos(mapToScene(n*b,m*b));
}
